import { Loading } from 'element-ui';
import request from '../utils/request';

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};

export const getOrderData = () => {
    return request({
        url: '/mrProduct/getWorkProduct',
        method: 'get',
    });
};
export const getBossProduct = () => {
    return request({
        url: '/mrProduct/getBossProduct',
        method: 'get',
    });
};
export const deleteOrderData = (params) => {
    return request({
        url: '/mrProduct/delProduct',
        method: 'delete',
        params
    });
};
export const deleteOrderDataAll = (params) => {
    return request({
        url: `/mrProduct/delProductList?ids=${params}`,
        method: 'delete',
        params
    });
};
//修改
export const updateProduct = (data) => {
    return request({
        url: '/mrProduct/updateProductById',
        method: 'post',
        data
    });
};
//新增
export const putProduct = (data) => {
    return request({
        url: '/mrProduct/putProduct',
        method: 'put',
        data
    });
};
//新增图片
export const getImgUrl = (data) => {
    return request({
        headers: { "Content-Type": "multipart/form-data" },
        url: '/mrProduct/getImgUrl',
        method: 'post',
        data
    });
};



//用户页面
//获取用户信息
export const getMoney = () => {
    return request({
        url: '/user/getUser',
        method: 'get',
    });
};

//获取订单消息
export const getAllOrders = (params) => {
    return request({
        url: '/mrProduct/getAllOrders',
        method: 'get',
        params
    });
};
//禁用用户
export const deleteUser = (data) => {
    return request({
        url: `/mrProduct/deleteUser?cloudId=${data}`,
        method: 'post',
    });
};
//修改用户身份
export const eidtUserPos = (data) => {
    return request({
        url: `/mrProduct/eidtUserPos?cloudId=${data}`,
        method: 'post',
        data
    });
};
//根据订单搜索
export const searchById = (params) => {
    return request({
        url: `/mrProduct/searchById`,
        method: 'get',
        params
    });
};